home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / XCMDs and XFCNs / BitDepth XFCN 1.0.0 / BitDepth.c next >
Encoding:
C/C++ Source or Header  |  1993-09-27  |  994 b   |  52 lines  |  [TEXT/R*ch]

  1. /* ----------------------------------------------------------------------
  2.  
  3.     BitDepth XFCN
  4.     version 1.0
  5.     25 September 1993
  6.     
  7.     Written by: Paul Celestin
  8.     
  9.     Copyright © 1993 Celestin Company
  10.     All Rights Reserved
  11.     
  12.     This XFCN returns the bit depth of the main screen.
  13.     
  14.     930925 - 1.0.0 - initial release
  15.  
  16. ---------------------------------------------------------------------- */
  17.  
  18. # include    <HyperXCMD.h>
  19. # include    <OSUtils.h>
  20. # include    <QuickDraw.h>
  21. # include    <SetUpA4.h>
  22.  
  23. pascal void main(XCmdPtr paramPtr)
  24. {
  25.     long            depth;
  26.     StringPtr        myString;
  27.     GDHandle        curDev;
  28.     PixMapHandle    myPixMap;
  29.     Rect            bounds;
  30.     SysEnvRec        myComputer;
  31.  
  32.      RememberA0();
  33.      SetUpA4();
  34.      
  35.     if (paramPtr->paramCount == 0)
  36.     {
  37.         SysEnvirons( 2,&myComputer );
  38.         if (myComputer.hasColorQD)
  39.         {
  40.             curDev = GetMainDevice();
  41.             myPixMap = (**curDev).gdPMap;
  42.             depth = (**myPixMap).pixelSize;
  43.         }
  44.         else depth = 1;
  45.  
  46.         NumToStr(paramPtr,depth,myString);
  47.         paramPtr->returnValue = PasToZero(paramPtr,myString);
  48.     }
  49.     
  50.     RestoreA4();
  51. }
  52.